<!DOCTYPE html>  
<html>  
    <head>  
        <meta charset="UTF-8">  
        <title></title>  
        <script src="AJAX函数的封装和调用.js" type="text/javascript" charset="utf-8"></script>  
        <script type="text/javascript">  
            window.onload = function () {  
                var a = document.getElementById('a');  
                var user = document.getElementById('a1');  
                var Password = document.getElementById('a2');  
                a.onclick = function (){  
                    //防止缓存,每次调用链接都加一个唯一的时间  
                    ajax('a.txt?t='+new Date().getTime(),function (str){  
                        var arr = eval(str);//将字符串转换为数组  
                        user.value = arr[0].a;  
                        Password.value = arr[0].b;  
                    },function(){  
                        alert('fail');  
                    });  
                }  
            }  
        </script>  
    </head>  
    <body>  
        <input type="button" name="a" id="a" value="123" />  
        user：<input type="text" name="a" id="a1" value="" />  
        password：<input type="text" name="a" id="a2" value="" />  
    </body>  
</html>  